It is possible to prompt with a if-statement if a link in a object is existing? I mean: for gobj_CurrentObject in gmod_CurrentModule do { for lnk_OutLink in gobj_CurrentObject -> "*" do { if(exists(outgoingLink) == true){} } }
Is there a function among the DXL Statements which satisfies my wish? bandchef - Fri Oct 25 08:53:42 EDT 2013 |
Re: Link == true? Possible? Hello, If your inside the for loop that goes through all outlinks, then you must have an outlink and you don't need the if statement. If there is no outlinks, then the for loop is skipped. Greg |
Re: Link == true? Possible?
Thank you for your answer!
for gobj_CurrentObject in gmod_CurrentModule do { for lnk_OutLink in gobj_CurrentObject -> "*" do { //Debug print numLinks gobj_CurrentObject."Object Text" "\n" gobj_CurrentObject."p_Link_Feature_existing""" == "True" } }
The thing is, that the debug statement appears in the interaction window of doors. But the line "gobj_CurrentObject."p_Link_Feature_existing""" == "True"" takes no effect. The Attribute p_Link_Feature_existing has "true" or "false" to choose. I have thought, if i make a left association the script can set the displayed value in doors...
I'm so sorry. I have Chosen the inocorrect Statement. This is the correct Statement: gobj_CurrentObject."p_Link_Feature_existing" = "True" |
Re: Link == true? Possible? bandchef - Mon Oct 28 09:49:59 EDT 2013
Thank you for your answer!
for gobj_CurrentObject in gmod_CurrentModule do { for lnk_OutLink in gobj_CurrentObject -> "*" do { //Debug print numLinks gobj_CurrentObject."Object Text" "\n" gobj_CurrentObject."p_Link_Feature_existing""" == "True" } }
The thing is, that the debug statement appears in the interaction window of doors. But the line "gobj_CurrentObject."p_Link_Feature_existing""" == "True"" takes no effect. The Attribute p_Link_Feature_existing has "true" or "false" to choose. I have thought, if i make a left association the script can set the displayed value in doors...
I'm so sorry. I have Chosen the inocorrect Statement. This is the correct Statement: gobj_CurrentObject."p_Link_Feature_existing" = "True" ( Hmmm ... You should try something like this ...
bool hasInLink( Object o, string linkModName ) { for o in current Module do { o."p_link_feature_existing" = hasLink o } Feel free to post your code if you are in trouble ;) ) |
Re: Link == true? Possible? bandchef - Mon Oct 28 09:49:59 EDT 2013
Thank you for your answer!
for gobj_CurrentObject in gmod_CurrentModule do { for lnk_OutLink in gobj_CurrentObject -> "*" do { //Debug print numLinks gobj_CurrentObject."Object Text" "\n" gobj_CurrentObject."p_Link_Feature_existing""" == "True" } }
The thing is, that the debug statement appears in the interaction window of doors. But the line "gobj_CurrentObject."p_Link_Feature_existing""" == "True"" takes no effect. The Attribute p_Link_Feature_existing has "true" or "false" to choose. I have thought, if i make a left association the script can set the displayed value in doors...
I'm so sorry. I have Chosen the inocorrect Statement. This is the correct Statement: gobj_CurrentObject."p_Link_Feature_existing" = "True" Hello, If the attribute p_Link_Feature_existing is a boolean, then your assignment statement should not have "True" but just true without the double quotes. The double quotes would be used if the attribute is a string. This error has nothing to do with the loop. Greg |
Re: Link == true? Possible? bandchef - Mon Oct 28 09:49:59 EDT 2013
Thank you for your answer!
for gobj_CurrentObject in gmod_CurrentModule do { for lnk_OutLink in gobj_CurrentObject -> "*" do { //Debug print numLinks gobj_CurrentObject."Object Text" "\n" gobj_CurrentObject."p_Link_Feature_existing""" == "True" } }
The thing is, that the debug statement appears in the interaction window of doors. But the line "gobj_CurrentObject."p_Link_Feature_existing""" == "True"" takes no effect. The Attribute p_Link_Feature_existing has "true" or "false" to choose. I have thought, if i make a left association the script can set the displayed value in doors...
I'm so sorry. I have Chosen the inocorrect Statement. This is the correct Statement: gobj_CurrentObject."p_Link_Feature_existing" = "True"
With "==" that is not an assignment statement, it is a comparison. It calculates to either true or false but does nothing besides that, and for some reason DXL doesn't complain. That like talking to somebody and saying "The Car". Use a single equal sign for assignment; get rid of double double quotes. If the attr is really a boolean, do this:
Actually I think what you want is the following. Lets create a boolean Attr-DXL that is "true" if the object has an outlink otherwise "false". This way the attr always has the correct information and you don't need to run an on-demand script to update the values.
Merge in pommCannelle's good clean advise: do well defiined chores in well defined functions. Now if your target attr is not "boolean" but is enumerated with "true" and "false" or "True" and "False" then your assignment would be a string. -Louie Digressing: If "False" is the first enumeration and "True" is second, turns out the boolean assignment will still work. |
Re: Link == true? Possible? llandale - Mon Oct 28 14:51:19 EDT 2013
With "==" that is not an assignment statement, it is a comparison. It calculates to either true or false but does nothing besides that, and for some reason DXL doesn't complain. That like talking to somebody and saying "The Car". Use a single equal sign for assignment; get rid of double double quotes. If the attr is really a boolean, do this:
Actually I think what you want is the following. Lets create a boolean Attr-DXL that is "true" if the object has an outlink otherwise "false". This way the attr always has the correct information and you don't need to run an on-demand script to update the values.
Merge in pommCannelle's good clean advise: do well defiined chores in well defined functions. Now if your target attr is not "boolean" but is enumerated with "true" and "false" or "True" and "False" then your assignment would be a string. -Louie Digressing: If "False" is the first enumeration and "True" is second, turns out the boolean assignment will still work. Owwww, my eyes can't see the fine print! |
Re: Link == true? Possible? GregM_dxler - Mon Oct 28 16:24:53 EDT 2013 Owwww, my eyes can't see the fine print! Don't know what I did wrong; cannot preview. Any ideas? |
Re: Link == true? Possible? llandale - Tue Oct 29 14:20:16 EDT 2013 Don't know what I did wrong; cannot preview. Any ideas? Must be a forum "enhancement". bandchef had already acknowledged that the "==" should have been an assignment "=" in his (?) fine print. The text below the square bullets is too small to read. Not sure if that was because you copied his text to your reply, the font size got even smaller then what he had (which is way too small). It seems to be below the resolution of my monitor now. Greg |